home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / MacSNMP / SNMP Agents Dev Kit / Sample Agent / Sources / SampleVar.h < prev   
Encoding:
C/C++ Source or Header  |  1994-11-21  |  3.2 KB  |  101 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        SampleVar.h
  3.  
  4.     Contains:    Declarations for the various variables
  5.  
  6.     Copyright:    © 1992-94 by Apple Computer, Inc., all rights reserved.
  7.  
  8. */
  9.  
  10. #ifndef __SAMPLEVAR__
  11. #define __SAMPLEVAR__
  12.  
  13. #ifndef __TYPES__
  14. #include <Types.h>
  15. #endif
  16.  
  17. #ifndef __SNMP__
  18. #include <SNMP.h>
  19. #endif
  20.  
  21. #ifndef __TSNMP__
  22. #include <TSNMP.h>
  23. #endif
  24.  
  25.  
  26.  
  27. /*********************************************************************************
  28.     TSampleDirectVar
  29.     
  30.     This variable class is initialized with a pointer to a variable storage 
  31.     location and the size of the variable.  The GetVariable, GetNextVariable, and
  32.     SetVariable member functions will manipulate the variable storage directly
  33.     in order to get or set the variable data.
  34. **********************************************************************************/
  35.  
  36. #define kTSampleDirectVarTkn    "snmp:var$TSampleDirectVar"
  37. #define kTSampleDirectVarID        "snmp:var$TSampleDirectVar,1.1"
  38.  
  39. class TSampleDirectVar : public TDevSNMPVar
  40. {
  41.     public:
  42.                         TSampleDirectVar();
  43.         virtual            ~TSampleDirectVar();
  44.         virtual    OSErr    InitSampleDirectVar(
  45.                                 TSNMPAgent* agent,                 // the agent who manages the variable
  46.                                 ObjectIDPtr id,                 // unique identifier of the variable
  47.                                 short         precedence,         // lowest value gets responsibility
  48.                                 ASNTagType    type,                // defines variable encoding
  49.                                 SMIAccess     access,             // read/write, read-only, or no access
  50.                                 short        descResID,            // resource id of description  STR# resource
  51.                                 short        descStrIndex,        // index of description string in STR# resource
  52.                                 void*        dataPtr,
  53.                                 short        dataSize);
  54.  
  55.         virtual    OSErr    GetVariable(Boolean next,ObjectIDPtr, VarBuf*);
  56.         virtual OSErr    SetVariable(ObjectIDPtr, VarBuf*, SetStage);
  57.         
  58.     private:
  59.         char*            fDataPtr;
  60.         short            fDataSize;                                        
  61. };
  62.  
  63. /*********************************************************************************
  64.     TSampleIndirectVar
  65.     
  66.     This variable class is initialized with pointers to a get and a set
  67.     function.  The GetVariable and SetVariable member
  68.     functions will call the get or set functions to perform the requested
  69.     get or set of the variable data.
  70. **********************************************************************************/
  71.  
  72. #define kTSampleIndirectVarTkn    "snmp:var$TSampleIndirectVar"
  73. #define kTSampleIndirectVarID    "snmp:var$TSampleIndirectVar,1.1"
  74.  
  75. class TSampleIndirectVar : public TDevSNMPVar
  76. {
  77.     public:
  78.                         TSampleIndirectVar();
  79.         virtual            ~TSampleIndirectVar();
  80.         
  81.         virtual    OSErr    InitSampleIndirectVar(
  82.                                 TSNMPAgent* agent,             // the agent who manages this variable
  83.                                 ObjectIDPtr id,             // unique identifier of the variable
  84.                                 short         precedence,     // lowest value gets responsibility
  85.                                 ASNTagType    type,            // defines variable encoding
  86.                                 SMIAccess     access,         // read/write, read-only, or no access
  87.                                 short        descResID,        // resource id of description  STR# resource
  88.                                 short        descStrIndex,    // index of description string in STR# resource
  89.                                 GetVarProcPtr getProc,
  90.                                 SetVarProcPtr setProc);
  91.  
  92.         virtual    OSErr    GetVariable(Boolean next,ObjectIDPtr, VarBuf*);
  93.         virtual OSErr    SetVariable(ObjectIDPtr, VarBuf*, SetStage);
  94.         
  95.     private:
  96.         GetVarProcPtr    fGetProc;
  97.           SetVarProcPtr    fSetProc;    // size of the value
  98. };
  99.  
  100. #endif __SAMPLEVAR__
  101.